package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 海关数据采集模块统一日志表：覆盖全流程操作、数据、异常、应用行为
 * @TableName customs_data_log
 */
@TableName(value ="customs_data_log")
@Data
public class CustomsDataLog implements Serializable {
    /**
     * 日志唯一ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 业务模块：1-数据采集入库 2-数据异常管理 3-数据应用查询 4-特征词校验 5-入库统计 6-数据采集日志汇总
     */
    private Integer bizModule;

    /**
     * 操作类型：1-采集（FTP/CSV/手工/主动） 2-入库 3-异常标记 4-异常修复 5-数据查询 6-特征词校验 7-统计计算 8-日志查询
     */
    private Integer bizType;

    /**
     * 操作描述（如“FTP采集上海洋山港数据”“手工录入报关单异常标记”）
     */
    private String operationDesc;

    /**
     * 关联业务ID（采集任务ID、报关单号、异常记录ID等）
     */
    private String relationId;

    /**
     * 操作人（系统/人工工号）
     */
    private String operator;

    /**
     * 操作时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date operateTime;

    /**
     * 请求参数（采集条件、异常修复内容等JSON）
     */
    private String requestParams;

    /**
     * 操作结果（成功/失败、异常信息、查询数据量等）
     */
    private String responseResult;

    /**
     * 扩展信息（如关区、数据版本、特征词匹配详情）
     */
    private String extInfo;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CustomsDataLog other = (CustomsDataLog) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getBizModule() == null ? other.getBizModule() == null : this.getBizModule().equals(other.getBizModule()))
            && (this.getBizType() == null ? other.getBizType() == null : this.getBizType().equals(other.getBizType()))
            && (this.getOperationDesc() == null ? other.getOperationDesc() == null : this.getOperationDesc().equals(other.getOperationDesc()))
            && (this.getRelationId() == null ? other.getRelationId() == null : this.getRelationId().equals(other.getRelationId()))
            && (this.getOperator() == null ? other.getOperator() == null : this.getOperator().equals(other.getOperator()))
            && (this.getOperateTime() == null ? other.getOperateTime() == null : this.getOperateTime().equals(other.getOperateTime()))
            && (this.getRequestParams() == null ? other.getRequestParams() == null : this.getRequestParams().equals(other.getRequestParams()))
            && (this.getResponseResult() == null ? other.getResponseResult() == null : this.getResponseResult().equals(other.getResponseResult()))
            && (this.getExtInfo() == null ? other.getExtInfo() == null : this.getExtInfo().equals(other.getExtInfo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getBizModule() == null) ? 0 : getBizModule().hashCode());
        result = prime * result + ((getBizType() == null) ? 0 : getBizType().hashCode());
        result = prime * result + ((getOperationDesc() == null) ? 0 : getOperationDesc().hashCode());
        result = prime * result + ((getRelationId() == null) ? 0 : getRelationId().hashCode());
        result = prime * result + ((getOperator() == null) ? 0 : getOperator().hashCode());
        result = prime * result + ((getOperateTime() == null) ? 0 : getOperateTime().hashCode());
        result = prime * result + ((getRequestParams() == null) ? 0 : getRequestParams().hashCode());
        result = prime * result + ((getResponseResult() == null) ? 0 : getResponseResult().hashCode());
        result = prime * result + ((getExtInfo() == null) ? 0 : getExtInfo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", bizModule=").append(bizModule);
        sb.append(", bizType=").append(bizType);
        sb.append(", operationDesc=").append(operationDesc);
        sb.append(", relationId=").append(relationId);
        sb.append(", operator=").append(operator);
        sb.append(", operateTime=").append(operateTime);
        sb.append(", requestParams=").append(requestParams);
        sb.append(", responseResult=").append(responseResult);
        sb.append(", extInfo=").append(extInfo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}